(function () {
  // 竖向轮播图
  var swiper = new Swiper('.swiper3', {
    spaceBetween: 30,
    centeredSlides: true,
    direction: 'vertical',
    autoplay: {
      delay: 2500,
      disableOnInteraction: false,
    }
  });



  // 侧边栏当前元素
  var bodyHeight = document.documentElement.clientHeight;
  var box = document.getElementById("box");
  window.addEventListener("scroll", function () {
    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    if (scrollTop > bodyHeight) {
      box.style.display = "block";
    } else {
      box.style.display = "none";
    };
  })
  // 回到顶部
  $(".box_b").on("click", function () {
    $('body,html').stop().animate({ scrollTop: 0 }, 500);
    return false;
  });

  // 导航的吸顶
  var tit = document.getElementById("nava");
  var tittop = tit.offsetTop;
  window.addEventListener("scroll", function () {
    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    //console.log(scrollTop);
    if (scrollTop > tittop) {
      tit.style.position = "fixed";
      tit.style.top = "0px";
      // 这是一个累加
      tit.style.cssText += "z-index:999";

    } else {
      tit.style.position = "static";
    }
  });

})();

